package csu.web.mypetstore.domain;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Log {
    private String username;
    private String logInfo;
    private static StringBuilder info = new StringBuilder();

    public String log(Object ...s) {
        info.delete(0,info.length());
        info.append(time());
        info.append("  ");
        for (Object str:s) {
            info.append(str);
            info.append(" ");
        }
        return info.toString();
    }

    public String logInformation(Object ...s) {
        return log(s);
    }

    public String time() {
        Date date = new Date();
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getLogInfo() {
        return logInfo;
    }

    public void setLogInfo(String logInfo) {
        this.logInfo = logInfo;
    }
}
